using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace WMVConvert.Metadata
{
	public class WMAttributeFactory
	{
		private Dictionary<string, WMAttribute> attributes = null;
		private Editor editor = null;

		internal WMAttributeFactory(Editor editor)
		{
			this.editor = editor;
			this.attributes = new Dictionary<string, WMAttribute>();
		}

		public WMAttribute this[string name]
		{
			get
			{
                name = name.Replace("/", string.Empty);
				PropertyInfo prop = this.GetType().GetProperty(name);
				if (prop != null)
				{
					return (WMAttribute)prop.GetValue(this, null);
				}
				return null;
			}
		}

		private WMAttribute CreateWMAttribute(string name, ItemType type)
		{
			return CreateWMAttribute(name, type, WMAttribute.DEFAULT_STREAM_NUMBER, null);
		}

		private WMAttribute CreateWMAttribute(string name, ItemType type, ushort streamNumber)
		{
			return CreateWMAttribute(name, type, streamNumber, null);
		}

		private WMAttribute CreateWMAttribute(string name, ItemType type, Type subType)
		{
			return CreateWMAttribute(name, type, WMAttribute.DEFAULT_STREAM_NUMBER, subType);
		}

		private WMAttribute CreateWMAttribute(string name, ItemType type, ushort streamNumber, Type subType)
		{
			WMAttribute attrib = null;
			if (!attributes.TryGetValue(name, out attrib))
			{
				attrib = new WMAttribute(this.editor,name,type,streamNumber,subType);
				attributes.Add(name, attrib);
			}
			return attrib;
		}

		public WMAttribute ASFLeakyBucketPairs { get { return CreateWMAttribute("ASFLeakyBucketPairs", ItemType.BINARY); } }
		public WMAttribute WMAspectRatioX { get { return CreateWMAttribute("AspectRatioX", ItemType.DWORD); } }
		public WMAttribute WMAspectRatioY { get { return CreateWMAttribute("AspectRatioY", ItemType.DWORD); } }
		public WMAttribute WMAuthor { get { return CreateWMAttribute("Author", ItemType.STRING); } }
		public WMAttribute AverageLevel { get { return CreateWMAttribute("AverageLevel", ItemType.DWORD); } }
		public WMAttribute WMBannerImageData { get { return CreateWMAttribute("BannerImageData", ItemType.BINARY); } }
		public WMAttribute WMBannerImageType { get { return CreateWMAttribute("BannerImageType", ItemType.DWORD); } }
		public WMAttribute WMBannerImageURL { get { return CreateWMAttribute("BannerImageURL", ItemType.STRING); } }
		public WMAttribute WMBitrate { get { return CreateWMAttribute("Bitrate", ItemType.DWORD); } }
		public WMAttribute WMBroadcast { get { return CreateWMAttribute("Broadcast", ItemType.BOOL); } }
		public WMAttribute BufferAverage { get { return CreateWMAttribute("BufferAverage", ItemType.DWORD); } }
		public WMAttribute WMSkipBackward { get { return CreateWMAttribute("Can_Skip_Backward", ItemType.BOOL); } }
		public WMAttribute WMSkipForward { get { return CreateWMAttribute("Can_Skip_Forward", ItemType.BOOL); } }
		public WMAttribute WMCopyright { get { return CreateWMAttribute("Copyright", ItemType.STRING); } }
		public WMAttribute WMCopyrightURL { get { return CreateWMAttribute("CopyrightURL", ItemType.STRING); } }
		public WMAttribute WMCurrentBitrate { get { return CreateWMAttribute("CurrentBitrate", ItemType.DWORD); } }
		public WMAttribute WMDescription { get { return CreateWMAttribute("Description", ItemType.STRING); } }
		public WMAttribute WMDRM_ContentID { get { return CreateWMAttribute("DRM_ContentID", ItemType.STRING); } }
		public WMAttribute WMDRM_DRMHeader_ContentDistributor { get { return CreateWMAttribute("DRM_DRMHeader_ContentDistributor", ItemType.STRING); } }
		public WMAttribute WMDRM_DRMHeader_ContentID { get { return CreateWMAttribute("DRM_DRMHeader_ContentID", ItemType.STRING); } }
		public WMAttribute WMDRM_DRMHeader_IndividualizedVersion { get { return CreateWMAttribute("DRM_DRMHeader_IndividualizedVersion", ItemType.STRING); } }
		public WMAttribute WMDRM_DRMHeader_KeyID { get { return CreateWMAttribute("DRM_DRMHeader_KeyID", ItemType.STRING); } }
		public WMAttribute WMDRM_DRMHeader_LicenseAcqURL { get { return CreateWMAttribute("DRM_DRMHeader_LicenseAcqURL", ItemType.STRING); } }
		public WMAttribute WMDRM_DRMHeader_SubscriptionContentID { get { return CreateWMAttribute("DRM_DRMHeader_SubscriptionContentID", ItemType.STRING); } }
		public WMAttribute WMDRM_DRMHeader { get { return CreateWMAttribute("DRM_DRMHeader", ItemType.STRING); } }
		public WMAttribute WMDRM_IndividualizedVersion { get { return CreateWMAttribute("DRM_IndividualizedVersion", ItemType.STRING); } }
		public WMAttribute WMDRM_KeyID { get { return CreateWMAttribute("DRM_KeyID", ItemType.STRING); } }
		public WMAttribute WMDRM_LASignatureCert { get { return CreateWMAttribute("DRM_LASignatureCert", ItemType.STRING); } }
		public WMAttribute WMDRM_LASignatureLicSrvCert { get { return CreateWMAttribute("DRM_LASignatureLicSrvCert", ItemType.STRING); } }
		public WMAttribute WMDRM_LASignaturePrivKey { get { return CreateWMAttribute("DRM_LASignaturePrivKey", ItemType.STRING); } }
		public WMAttribute WMDRM_LASignatureRootCert { get { return CreateWMAttribute("DRM_LASignatureRootCert", ItemType.STRING); } }
		public WMAttribute WMDRM_LicenseAcqURL { get { return CreateWMAttribute("DRM_LicenseAcqURL", ItemType.STRING); } }
		public WMAttribute WMDRM_LicenseID { get { return CreateWMAttribute("DRM_LicenseID", ItemType.STRING); } }
		public WMAttribute WMDRM_SourceID { get { return CreateWMAttribute("DRM_SourceID", ItemType.DWORD); } }
		public WMAttribute WMDRM_V1LicenseAcqURL { get { return CreateWMAttribute("DRM_V1LicenseAcqURL", ItemType.STRING); } }
		public WMAttribute WMDuration { get { return CreateWMAttribute("Duration", ItemType.QWORD); } }
		public WMAttribute WMFileSize { get { return CreateWMAttribute("FileSize", ItemType.QWORD); } }
		public WMAttribute WMHasArbitraryDataStream { get { return CreateWMAttribute("HasArbitraryDataStream", ItemType.BOOL); } }
		public WMAttribute WMHasAttachedImages { get { return CreateWMAttribute("HasAttachedImages", ItemType.BOOL); } }
		public WMAttribute WMHasAudio { get { return CreateWMAttribute("HasAudio", ItemType.BOOL); } }
		public WMAttribute WMHasFileTransferStream { get { return CreateWMAttribute("HasFileTransferStream", ItemType.BOOL); } }
		public WMAttribute WMHasImage { get { return CreateWMAttribute("HasImage", ItemType.BOOL); } }
		public WMAttribute WMHasScript { get { return CreateWMAttribute("HasScript", ItemType.BOOL); } }
		public WMAttribute WMHasVideo { get { return CreateWMAttribute("HasVideo", ItemType.BOOL); } }
		public WMAttribute WMProtected { get { return CreateWMAttribute("Is_Protected", ItemType.BOOL); } }
		public WMAttribute WMTrusted { get { return CreateWMAttribute("Is_Trusted", ItemType.BOOL); } }
		public WMAttribute ISAN { get { return CreateWMAttribute("ISAN", ItemType.STRING); } }
		public WMAttribute WMIsVBR { get { return CreateWMAttribute("IsVBR", ItemType.BOOL); } }
		public WMAttribute WMNSCAddress { get { return CreateWMAttribute("NSC_Address", ItemType.STRING); } }
		public WMAttribute WMNSCDescription { get { return CreateWMAttribute("NSC_Description", ItemType.STRING); } }
		public WMAttribute WMNSCEmail { get { return CreateWMAttribute("NSC_Email", ItemType.STRING); } }
		public WMAttribute WMNSCName { get { return CreateWMAttribute("NSC_Name", ItemType.STRING); } }
		public WMAttribute WMNSCPhone { get { return CreateWMAttribute("NSC_Phone", ItemType.STRING); } }
		public WMAttribute WMNumberOfFrames { get { return CreateWMAttribute("NumberOfFrames", ItemType.QWORD); } }
		public WMAttribute WMOptimalBitrate { get { return CreateWMAttribute("OptimalBitrate", ItemType.DWORD); } }
		public WMAttribute PeakValue { get { return CreateWMAttribute("PeakValue", ItemType.DWORD); } }
		public WMAttribute WMRating { get { return CreateWMAttribute("Rating", ItemType.STRING); } }
		public WMAttribute WMSeekable { get { return CreateWMAttribute("Seekable", ItemType.BOOL); } }
		public WMAttribute WMSignature_Name { get { return CreateWMAttribute("Signature_Name", ItemType.STRING); } }
		public WMAttribute WMStridable { get { return CreateWMAttribute("Stridable", ItemType.BOOL); } }
		public WMAttribute WMTitle { get { return CreateWMAttribute("Title", ItemType.STRING); } }
		public WMAttribute VBRPeak { get { return CreateWMAttribute("VBRPeak", ItemType.DWORD); } }
		public WMAttribute WMAlbumArtist { get { return CreateWMAttribute("WM/AlbumArtist", ItemType.STRING); } }
		public WMAttribute WMAlbumCoverURL { get { return CreateWMAttribute("WM/AlbumCoverURL", ItemType.STRING); } }
		public WMAttribute WMAlbumTitle { get { return CreateWMAttribute("WM/AlbumTitle", ItemType.STRING); } }
		public WMAttribute WMASFPacketCount { get { return CreateWMAttribute("WM/ASFPacketCount", ItemType.QWORD); } }
		public WMAttribute WMASFSecurityObjectsSize { get { return CreateWMAttribute("WM/ASFSecurityObjectsSize", ItemType.QWORD); } }
		public WMAttribute WMAudioFileURL { get { return CreateWMAttribute("WM/AudioFileURL", ItemType.STRING); } }
		public WMAttribute WMAudioSourceURL { get { return CreateWMAttribute("WM/AudioSourceURL", ItemType.STRING); } }
		public WMAttribute WMAuthorURL { get { return CreateWMAttribute("WM/AuthorURL", ItemType.STRING); } }
		public WMAttribute WMBeatsPerMinute { get { return CreateWMAttribute("WM/BeatsPerMinute", ItemType.STRING); } }
		public WMAttribute WMCategory { get { return CreateWMAttribute("WM/Category", ItemType.STRING); } }
		public WMAttribute WMCodec { get { return CreateWMAttribute("WM/Codec", ItemType.STRING); } }
		public WMAttribute WMComposer { get { return CreateWMAttribute("WM/Composer", ItemType.STRING); } }
		public WMAttribute WMConductor { get { return CreateWMAttribute("WM/Conductor", ItemType.STRING); } }
		public WMAttribute WMContainerFormat { get { return CreateWMAttribute("WM/ContainerFormat", ItemType.BINARY, typeof(Structures.WMT_STORAGE_FORMAT)); } }
		public WMAttribute WMContentDistributor { get { return CreateWMAttribute("WM/ContentDistributor", ItemType.STRING); } }
		public WMAttribute WMContentGroupDescription { get { return CreateWMAttribute("WM/ContentGroupDescription", ItemType.STRING); } }
		public WMAttribute WMDirector { get { return CreateWMAttribute("WM/Director", ItemType.STRING); } }
		public WMAttribute WMDRM { get { return CreateWMAttribute("WM/DRM", ItemType.STRING); } }
		public WMAttribute WMDVDID { get { return CreateWMAttribute("WM/DVDID", ItemType.STRING); } }
		public WMAttribute WMEncodedBy { get { return CreateWMAttribute("WM/EncodedBy", ItemType.STRING); } }
		public WMAttribute WMEncodingSettings { get { return CreateWMAttribute("WM/EncodingSettings", ItemType.STRING); } }
		public WMAttribute WMEncodingTime { get { return CreateWMAttribute("WM/EncodingTime", ItemType.QWORD); } }
		public WMAttribute WMEpisodeNumber { get { return CreateWMAttribute("WM/EpisodeNumber", ItemType.DWORD); } }
		public WMAttribute WMGenre { get { return CreateWMAttribute("WM/Genre", ItemType.STRING); } }
		public WMAttribute WMGenreID { get { return CreateWMAttribute("WM/GenreID", ItemType.STRING); } }
		public WMAttribute WMInitialKey { get { return CreateWMAttribute("WM/InitialKey", ItemType.STRING); } }
		public WMAttribute WMISRC { get { return CreateWMAttribute("WM/ISRC", ItemType.STRING); } }
		public WMAttribute WMLanguage { get { return CreateWMAttribute("WM/Language", ItemType.STRING); } }
		public WMAttribute WMLyrics { get { return CreateWMAttribute("WM/Lyrics", ItemType.STRING); } }
		public WMAttribute WMLyrics_Synchronised { get { return CreateWMAttribute("WM/Lyrics_Synchronised", ItemType.BINARY, typeof(WMSynchronisedLyrics)); } }
		public WMAttribute WMMCDI { get { return CreateWMAttribute("WM/MCDI", ItemType.BINARY); } }
		public WMAttribute WMMediaClassPrimaryID { get { return CreateWMAttribute("WM/MediaClassPrimaryID", ItemType.GUID); } }
		public WMAttribute WMMediaClassSecondaryID { get { return CreateWMAttribute("WM/MediaClassSecondaryID", ItemType.GUID, typeof(WMMediaKindValue)); } }
		public WMAttribute WMMediaCredits { get { return CreateWMAttribute("WM/MediaCredits", ItemType.STRING); } }
		public WMAttribute WMMediaIsDelay { get { return CreateWMAttribute("WM/MediaIsDelay", ItemType.BOOL); } }
		public WMAttribute WMMediaIsFinale { get { return CreateWMAttribute("WM/MediaIsFinale", ItemType.BOOL); } }
		public WMAttribute WMMediaIsLive { get { return CreateWMAttribute("WM/MediaIsLive", ItemType.BOOL); } }
		public WMAttribute WMMediaIsPremiere { get { return CreateWMAttribute("WM/MediaIsPremiere", ItemType.BOOL); } }
		public WMAttribute WMMediaIsRepeat { get { return CreateWMAttribute("WM/MediaIsRepeat", ItemType.BOOL); } }
		public WMAttribute WMMediaIsSAP { get { return CreateWMAttribute("WM/MediaIsSAP", ItemType.BOOL); } }
		public WMAttribute WMMediaIsStereo { get { return CreateWMAttribute("WM/MediaIsStereo", ItemType.BOOL); } }
		public WMAttribute WMMediaIsSubtitled { get { return CreateWMAttribute("WM/MediaIsSubtitled", ItemType.BOOL); } }
		public WMAttribute WMMediaIsTape { get { return CreateWMAttribute("WM/MediaIsTape", ItemType.BOOL); } }
		public WMAttribute WMMediaNetworkAffiliation { get { return CreateWMAttribute("WM/MediaNetworkAffiliation", ItemType.STRING); } }
		public WMAttribute WMMediaOriginalBroadcastDateTime { get { return CreateWMAttribute("WM/MediaOriginalBroadcastDateTime", ItemType.STRING); } }
		public WMAttribute WMMediaOriginalChannel { get { return CreateWMAttribute("WM/MediaOriginalChannel", ItemType.STRING); } }
		public WMAttribute WMMediaStationCallSign { get { return CreateWMAttribute("WM/MediaStationCallSign", ItemType.STRING); } }
		public WMAttribute WMMediaStationName { get { return CreateWMAttribute("WM/MediaStationName", ItemType.STRING); } }
		public WMAttribute WMModifiedBy { get { return CreateWMAttribute("WM/ModifiedBy", ItemType.STRING); } }
		public WMAttribute WMMood { get { return CreateWMAttribute("WM/Mood", ItemType.STRING); } }
		public WMAttribute WMOriginalAlbumTitle { get { return CreateWMAttribute("WM/OriginalAlbumTitle", ItemType.STRING); } }
		public WMAttribute WMOriginalArtist { get { return CreateWMAttribute("WM/OriginalArtist", ItemType.STRING); } }
		public WMAttribute WMOriginalFilename { get { return CreateWMAttribute("WM/OriginalFilename", ItemType.STRING); } }
		public WMAttribute WMOriginalLyricist { get { return CreateWMAttribute("WM/OriginalLyricist", ItemType.STRING); } }
		public WMAttribute WMOriginalReleaseTime { get { return CreateWMAttribute("WM/OriginalReleaseTime", ItemType.STRING); } }
		public WMAttribute WMOriginalReleaseYear { get { return CreateWMAttribute("WM/OriginalReleaseYear", ItemType.STRING); } }
		public WMAttribute WMParentalRating { get { return CreateWMAttribute("WM/ParentalRating", ItemType.STRING); } }
		public WMAttribute WMParentalRatingSystem { get { return CreateWMAttribute("WM/ParentalRatingSystem", ItemType.STRING); } }
		public WMAttribute WMParentalRatingReason { get { return CreateWMAttribute("WM/ParentalRatingReason", ItemType.STRING); } }
		public WMAttribute WMPartOfSet { get { return CreateWMAttribute("WM/PartOfSet", ItemType.STRING); } }
		public WMAttribute WMPeakBitrate { get { return CreateWMAttribute("WM/PeakBitrate", ItemType.DWORD); } }
		public WMAttribute WMPeriod { get { return CreateWMAttribute("WM/Period", ItemType.STRING); } }
		public WMAttribute WMPicture { get { return CreateWMAttribute("WM/Picture", ItemType.BINARY, typeof(WMPicture)); } }
		public WMAttribute WMPlaylistDelay { get { return CreateWMAttribute("WM/PlaylistDelay", ItemType.STRING); } }
		public WMAttribute WMProducer { get { return CreateWMAttribute("WM/Producer", ItemType.STRING); } }
		public WMAttribute WMPromotionURL { get { return CreateWMAttribute("WM/PromotionURL", ItemType.STRING); } }
		public WMAttribute WMProtectionType { get { return CreateWMAttribute("WM/ProtectionType", ItemType.STRING); } }
		public WMAttribute WMProvider { get { return CreateWMAttribute("WM/Provider", ItemType.STRING); } }
		public WMAttribute WMProviderCopyright { get { return CreateWMAttribute("WM/ProviderCopyright", ItemType.STRING); } }
		public WMAttribute WMProviderRating { get { return CreateWMAttribute("WM/ProviderRating", ItemType.STRING); } }
		public WMAttribute WMProviderStyle { get { return CreateWMAttribute("WM/ProviderStyle", ItemType.STRING); } }
		public WMAttribute WMPublisher { get { return CreateWMAttribute("WM/Publisher", ItemType.STRING); } }
		public WMAttribute WMRadioStationName { get { return CreateWMAttribute("WM/RadioStationName", ItemType.STRING); } }
		public WMAttribute WMRadioStationOwner { get { return CreateWMAttribute("WM/RadioStationOwner", ItemType.STRING); } }
		public WMAttribute WMSeasonNumber { get { return CreateWMAttribute("WM/SeasonNumber", ItemType.DWORD); } }
		public WMAttribute WMSharedUserRating { get { return CreateWMAttribute("WM/SharedUserRating", ItemType.DWORD); } }
		public WMAttribute WMStreamTypeInfo { get { return CreateWMAttribute("WM/StreamTypeInfo", ItemType.BINARY, typeof(Structures.WM_STREAM_TYPE_INFO)); } }
		public WMAttribute WMSubscriptionContentID { get { return CreateWMAttribute("WM/SubscriptionContentID", ItemType.STRING); } }
		public WMAttribute WMSubTitle { get { return CreateWMAttribute("WM/SubTitle", ItemType.STRING); } }
		public WMAttribute WMSubTitleDescription { get { return CreateWMAttribute("WM/SubTitleDescription", ItemType.STRING); } }
		public WMAttribute WMText { get { return CreateWMAttribute("WM/Text", ItemType.BINARY, typeof(Structures.WM_USER_TEXT)); } }
		public WMAttribute WMToolName { get { return CreateWMAttribute("WM/ToolName", ItemType.STRING); } }
		public WMAttribute WMToolVersion { get { return CreateWMAttribute("WM/ToolVersion", ItemType.STRING); } }
		public WMAttribute WMTrack { get { return CreateWMAttribute("WM/Track", ItemType.STRING); } }
		public WMAttribute WMTrackNumber { get { return CreateWMAttribute("WM/TrackNumber", ItemType.STRING); } }
		public WMAttribute WMUniqueFileIdentifier { get { return CreateWMAttribute("WM/UniqueFileIdentifier", ItemType.STRING); } }
		public WMAttribute WMUserWebURL { get { return CreateWMAttribute("WM/UserWebURL", ItemType.BINARY,typeof(Structures.WM_USER_WEB_URL)); } }
		public WMAttribute WMVideoClosedCaptioning { get { return CreateWMAttribute("WM/VideoClosedCaptioning", ItemType.BOOL); } }
		public WMAttribute WMVideoFrameRate { get { return CreateWMAttribute("WM/VideoFrameRate", ItemType.DWORD); } }
		public WMAttribute WMVideoHeight { get { return CreateWMAttribute("WM/VideoHeight", ItemType.DWORD); } }
		public WMAttribute WMVideoWidth { get { return CreateWMAttribute("WM/VideoWidth", ItemType.DWORD); } }
		public WMAttribute WMWMADRCAverageReference { get { return CreateWMAttribute("WM/WMADRCAverageReference", ItemType.DWORD); } }
		public WMAttribute WMWMADRCAverageTarget { get { return CreateWMAttribute("WM/WMADRCAverageTarget", ItemType.DWORD); } }
		public WMAttribute WMWMADRCPeakReference { get { return CreateWMAttribute("WM/WMADRCPeakReference", ItemType.DWORD); } }
		public WMAttribute WMWMADRCPeakTarget { get { return CreateWMAttribute("WM/WMADRCPeakTarget", ItemType.DWORD); } }
		public WMAttribute WMWMCollectionGroupID { get { return CreateWMAttribute("WM/WMCollectionGroupID", ItemType.GUID); } }
		public WMAttribute WMWMCollectionID { get { return CreateWMAttribute("WM/WMCollectionID", ItemType.GUID); } }
		public WMAttribute WMWMContentID { get { return CreateWMAttribute("WM/WMContentID", ItemType.GUID); } }
		public WMAttribute WMWMShadowFileSourceDRMType { get { return CreateWMAttribute("WM/WMShadowFileSourceDRMType", ItemType.STRING); } }
		public WMAttribute WMWMShadowFileSourceFileType { get { return CreateWMAttribute("WM/WMShadowFileSourceFileType", ItemType.STRING); } }
		public WMAttribute WMWriter { get { return CreateWMAttribute("WM/Writer", ItemType.STRING); } }
		public WMAttribute WMYear { get { return CreateWMAttribute("WM/Year", ItemType.STRING); } }
		public WMAttribute ZuneMediaID { get { return CreateWMAttribute("ZuneMediaID", ItemType.GUID); } }
	}
}
